Component ({
  data: {
    activeIndex: 0,
    list: [
      {
        pagePath: "/pages/index/index",
        text: "首页",
      },
      {
        pagePath: "/pages/category/index",
        text: "分类",
        iconPath: "/images/category.png",
        selectedIconPath: "/images/category-active.png"
      },
      {
        pagePath: "/pages/cart/index",
        text: "购物车",
        iconPath: "/images/cart.png",
        selectedIconPath: "/images/cart-active.png"
      },
      {
        pagePath: "/pages/user/index",
        text: "我的",
        iconPath: "/images/user.png",
        selectedIconPath: "/images/user-active.png"
      }
    ]
  },
  methods: {
    switchTab(e) {
      const index = e.currentTarget.dataset.index
      wx.switchTab({
        url: this.data.list[index].pagePath
      })
    }
  }
})